home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15148 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: H E L P
  5. Date: 3 Apr 1996 16:36:55 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4juui7$a8a@solutions.solon.com>
  8. References: <N.040296.013047.18@DynamicPPP-185.HIP.CAM.ORG> <Pine.A32.3.91.960402135001.121719B-100000@green.weeg.uiowa.edu> <4js6jh$ndr@solutions.solon.com> <DpAx1J.4n9@iquest.net>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <DpAx1J.4n9@iquest.net>, Doug Miller <dlmiller@iquest.net> wrote:
  12. >Obviously you didn't read what he wrote.  To satisfy the conditions of the
  13. >task as he stated it, he would need an infinite number of ifs ("whatever
  14. >number I enter...").  I saw nothing in his statement of the task that placed
  15. >any limits of any sort on the number -- thus, he *does* need a loop.
  16.  
  17. Well, assuming he's using integers to represent the age, the space isn't
  18. *infinite*.  It's just *large*.  We can ignore negative numbers (after all, we
  19. can't print a negative number of smileys), and we can thus get away with only
  20. INT_MAX ifs.
  21.  
  22. My assumption had also been that it would be a real person's age, at which
  23. point (barring the Wandering Jew) we have only about 150 cases to worry about.
  24.  
  25. Now, it would be moronically stupid to do this, but you *could* do it.
  26.  
  27. For extra credit, prove that you can do at least 15-bit numbers within
  28. numbers with the 15 levels of nesting guaranteed by the standard, and
  29. point out the limitation you'd run into, and at least one way around it
  30. without relying on loops.
  31.  
  32. -s
  33. -- 
  34. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  35. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  36. FUCK the communications decency act.  Goddamned government.  [literally.]
  37. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  38.